<html>

<head>
     <style type="text/css">
        body {margin-left: 5% ; margin-right: 5%; margin-top: 0.5in;
             font-family: verdana, arial,"trebuchet ms", helvetica, sans-serif;}
        ul {list-style: disc;}
     </style>
     <title>App Inventor Database</title>
</head>


<body>
<h2>App Inventor (TinyWebDB) Web Database Service</h2>
<table border=0>
<tr valign="top">
<td><image src="/images/customLogo.gif" width="200" hspace="10"></td>
<td>
<p>
This web service stores and retrieves values for an  <a
href="http://appinventor.googlelabs.com">App Inventor
for Android</a> app. App Inventor apps can access this service using the TinyWebDB component and setting the ServiceURL to the URL of this site. </p>

</td> </tr> 
</table>

    <h3> Search database for a tag</h3>
    <form action="/getvalue" method="post"
          enctype=application/x-www-form-urlencoded>
       <p>Tag:<input type="text" name="tag" /></p>
       <input type="hidden" name="fmt" value="html">
	   <input type="hidden" name="fmt2" value="html">
       <input type="submit" value="Get value">
    </form>
   
    Returned as value to TinyWebDB component:
   <b>{{result}}</b>

  <br/>
<h3>Store a tag-value pair in the databse</h3>
<form action="/storeavalue" method="post"
		  enctype=application/x-www-form-urlencoded>
	   <p>Tag: <input type="text" name="tag" size="30"/></p>
	   <p>GPS(lat;lon): <input type="text" name="value" size="30"/></p>
	   <input type="hidden" name="fmt" value="html">
	   <input type="hidden" name="fmt2" value="html">
	   <input type="submit" value="Store a value">
	</form>
 <br/>

	<table border=1>
	  <tr>
		 <th>Tag</th>
		 <th>Latitude</th>
		 <th>Longitude</th>
		 <th>Created (GMT)</th>
	  </tr>
	  {% for entry in entryList %}
	  <tr>
	         <td>{{entry.tag}}</td>
		<td>{{entry.latitude}}</td>
		<td>{{entry.longitude}}</td>
		<td><font size="-1">{{entry.date}}</font></td>
          
	  	<td><form action="/deleteentry" method="post"
			enctype=application/x-www-form-urlencoded>
		<input type="hidden" name="entry_key_string" value="{{entry.key}}">
		<input type="hidden" name="tag" value="{{entry.tag}}">
			<input type="hidden" name="fmt" value="html">
			<input type="hidden" name="fmt2" value="html">
		<input type="submit" style="background-color: red" value="Delete"></form></td>
          </tr>
	  {% endfor %}

	</table>
</body></html>